package com.longbo.leaf.portal.controller;


import com.longbo.leaf.common.ApiResponse;
import com.longbo.leaf.portal.model.Goods;
import com.longbo.leaf.portal.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 商品表 前端控制器
 * </p>
 *
 * @author longbo
 * @since 2021-03-04
 */
@RestController
@RequestMapping("/portal/goods")
public class GoodsController {
    @Autowired
    IGoodsService goodsService;

    /**
     * 查询所有商品
     * @return
     */
    @RequestMapping("/all")
    public ApiResponse selectAllGoods(){
        List<Goods> goodsList = goodsService.selectAll();
        return ApiResponse.ofSuccess(goodsList);
    }

}
